package com.amoyt.project.controller.admin;

import com.amoyt.project.domain.res.Result;
import com.amoyt.project.service.admin.DataService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Date: 2025/8/28
 * @Time: 0:21
 * @Author: TQ_QT
 * @Description:
 */
@RestController
@RequestMapping("/admin/data")
@Tag(name = "数据统计接口",description = "数据统计接口")
public class DataController {
    @Autowired
    private DataService dataService;

    /**
     * 统计贫困户数据
     * @return
     */
    @GetMapping("/poverty")
    @Operation(summary = "贫困户数据统计",method = "GET")
    @Parameter(name = "token",description = "访问令牌",required = true,in = ParameterIn.HEADER)
    public Result poverty(){
        return dataService.poverty();
    }

    /**
     * 统计g管理员用户数据
     *
     */
    @GetMapping("/users")
    @Operation(summary = "用户数据统计",method = "GET")
    @Parameter(name = "token",description = "访问令牌",required = true,in = ParameterIn.HEADER)
    public Result adminList(){
        return dataService.userList();
    }


    /**
     * 文章数据统计
     * @return
     */
    @GetMapping("/articles")
    @Operation(summary = "公告数据统计",method = "GET")
    @Parameter(name = "token",description = "访问令牌",required = true,in = ParameterIn.HEADER)
    public Result articleList(){
        return dataService.articleList();
    }

    /**
     * 项目数据统计
     * @return
     */
    @GetMapping("/projects")
    @Operation(summary = "项目数据统计",method = "GET")
    @Parameter(name = "token",description = "访问令牌",required = true,in = ParameterIn.HEADER)
    public Result projectList(){
        return dataService.projectList();
    }

    /**
     * 留言数据统计
     * @return
     */
    @GetMapping("/back/{day}")
    @Operation(summary = "投诉反馈数据统计+待处理",method = "GET")
    @Parameter(name = "token",description = "访问令牌",required = true,in = ParameterIn.HEADER)
    public Result backList(@PathVariable("day") Integer day){
        return dataService.backList(day);
    }
}
